<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
    <meta http-equiv="Cache-Control" CONTENT="no-cache">
    <meta http-equiv="Pragma" CONTENT="no-cache">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>积微物联 运营管理管理系统</title>
    <link rel="stylesheet" type="text/css" href="${base}/css/Reset.css"/>
    <link rel="stylesheet" type="text/css" href="${base}/css/login.css"/>
    <script type="text/javascript" src="${base}/easyui/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="${base}/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript">
        $(function () {
            var flag = false;
            Sys = {};
            var ua = navigator.userAgent.toLowerCase();
            if ((window.attachEvent && window.ActiveXObject && ua.indexOf("msie") > 0 ) || ua.indexOf("trident") > 0) {
                flag = true;
                Sys.ie = ua.match(/(msie\s|trident.*rv:)([\w.]+)/)[1];
                if (parseInt(Sys.ie) == 7) {
                    if (document.documentMode) {
                        Sys.ie = 8.0; //reset? change if you need to
                    }
                }
            }
            else if (ua.indexOf("firefox") > 0) {
                flag = true;
                Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1]
            }

            if (!flag || Sys.ie < 8) {
                $("#errorMessages").text("当前浏览器不是IE或者火狐浏览器，或者IE浏览器版本过低。请下载IE8以上版本或者火狐浏览器访问");
                $("#dowloadAddr").show();
            } else {
                $("#dowloadAddr").hide();

                $(document).keypress(function (e) {
                    if (!e.ctrlKey && e.which == 13) {
                        var isValidate = true;
                        $("#userName,#password,#idenCode").each(
                                function () {
                                    if ($(this).val() == "") {
                                        isValidate = false;
                                        $(this).focus();
                                        return false;
                                    }
                                }
                        )

                        if (isValidate) {
                            $("#loginForm").attr('action', '${base}/main/index');
                            $("#loginForm").submit();
                        }
                    }
                })


                $('#loginForm').form({
                    url: 'login',
                    success: function (data) {
                        if (data === 'true') {
                            self.location.href = '${base}/main/index';
                        } else {
                            $('#errorMessages').html(data).show();
                            var timenow = new Date().getTime();
                            $(".pic").attr('src', "rand?d=" + timenow);
                            $("#userName").focus();
                        }
                    }
                });
            }
            var timenow = new Date().getTime();
            if ($("#userName").val()) {
                $("#password").focus();
            } else
                $("#userName").focus();
            $(".pic").attr('src', "rand?d=" + timenow);

            $("#login").focusin(function () {
                $("#login").removeClass("button");
                $("#login").addClass("button1");
            });

            $("#login").focusout(function () {
                $("#login").removeClass("button1");
                $("#login").addClass("button");
            });

        });

        function changeValidateCode(obj) {
            //获取当前的时间作为参数，无具体意义
            var timenow = new Date().getTime();
            //每次请求需要一个不同的参数，否则可能会返回同样的验证码
            //这和浏览器的缓存机制有关系，也可以把页面设置为不缓存，这样就不用这个参数了。
            obj.src = "rand?d=" + timenow;
        }

    </script>
    <script type="text/javascript">
        $(function () {
            if (self != top) {
                window.top.location.href = "${base}/portal/login";
            }
        })
    </script>
</head>

<body>

<div class="logo-b">

    <form id="loginForm" method="post">
        <div class="login">

            <div><input type="text" id="userName" name="userName" class="full" value="${(userName)!}"
                        data-options="required:true"/></div>
            <div style="margin-top: 42px;"><input id="password" type="password" name="password" class="full" value=""
                                                  data-options="required:true"/></div>
            <div style="margin-top: 85px;"><input id="idenCode" type="text" name="idenCode" value="" class="full duan"
                                                  data-options="required:true"/></div>
            <div style="margin-top: 85px;margin-left: 115px;"><img alt="验证码" title="点击刷新"
                                                                   onclick="changeValidateCode(this)"
                                                                   class="pic"/></div>
            <div id="errorMessages" style="color: #f7700c;margin-top: 5px;height: 1px">${(exception.message)!}</div>
            <div style="margin-top: 25px;margin-left: -30px"><input id="login" type="button"
                                                                    onclick="$('#loginForm').submit();" class="button"/>
            </div>

        </div>

        <table cellpadding="0" cellspacing="0" border="0" style="position:absolute;top:150px;" class="input">
            <tr>
                <td colspan='4' id="errorMessages" style="color: #f7700c;">${(exception.message)!}
                </td>
            </tr>
            <tr id="dowloadAddr">
                <td colspan='4'>

                    <a href="http://download.microsoft.com/download/1/6/1/16174D37-73C1-4F76-A305-902E9D32BAC9/IE8-WindowsXP-x86-CHS.exe"
                       style="color:red">IE8下载地址</a>

                    <a href="http://download.firefox.com.cn/releases/webins3.0/official/zh-CN/Firefox-latest.exe"
                       style="color:red">火狐下载地址</a>

                </td>
            </tr>
        </table>

    </form>  <#--#F8F8FF-->
    <div class="foot"style="color:#FFFAFA">Copyright © 2015 Jiweiwulian. 成都达海积微物联电子商务有限公司 版权所有</div>
</div>
</body>
</html>